﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ReportViewer.ascx.cs"
    Inherits="SIPO.Web.usercontrols.ReportViewer" %>
<script type="text/javascript">

    $(document).ready(function () {

        $('#' + '<%= txtNewPage.ClientID %>').keydown(function () {
            if (event.keyCode == 13) {
                __doPostBack('<%= imbGoTo.UniqueID %>', ''); return false;
            }
        });

        $('#' + '<%= txtSearch.ClientID %>').keydown(function () {
            if (event.keyCode == 13) {
                __doPostBack('<%= imbSearch.UniqueID %>', ''); return false;
            }
        });

    });
	
</script>
<script language="javascript" type="text/javascript">

    function ButtonEnability(first, prev, next, last) {

        if (first)
            $('#' + '<%= imbFirst.ClientID %>').attr('src', '../App_Themes/default/images/cr/first.gif');
        else {
            $('#' + '<%= imbFirst.ClientID %>').attr('src', '../App_Themes/default/images/cr/firstd.gif');
            $('#' + '<%= imbFirst.ClientID %>').attr('disabled', 'true');
        }
        if (prev)
            $('#' + '<%= imbPrev.ClientID %>').attr('src', '../App_Themes/default/images/cr/prev.gif');
        else {
            $('#' + '<%= imbPrev.ClientID %>').attr('src', '../App_Themes/default/images/cr/prevd.gif');
            $('#' + '<%= imbPrev.ClientID %>').attr('disabled', 'true');
        }
        if (next)
            $('#' + '<%= imbNext.ClientID %>').attr('src', '../App_Themes/default/images/cr/next.gif');
        else {
            $('#' + '<%= imbNext.ClientID %>').attr('src', '../App_Themes/default/images/cr/nextd.gif');
            $('#' + '<%= imbNext.ClientID %>').attr('disabled', 'true');
        }
        if (last)
            $('#' + '<%= imbLast.ClientID %>').attr('src', '../App_Themes/default/images/cr/last.gif');
        else {
            $('#' + '<%= imbLast.ClientID %>').attr('src', '../App_Themes/default/images/cr/lastd.gif');
            $('#' + '<%= imbLast.ClientID %>').attr('disabled', 'true');
        }
    }


    $(document).ready(function () {

        var iCurr = $('#' + '<%= lblCurrentPage.ClientID %>').text();
        var iPages = $('#' + '<%= lblTotalPages.ClientID %>').text();

        if (iCurr > 1) {
            if (iCurr == iPages)
                ButtonEnability(true, true, false, false);
            else
                ButtonEnability(true, true, true, true);
        }
        else {
            if (iCurr == iPages)
                ButtonEnability(false, false, false, false);
            else
                ButtonEnability(false, false, true, true);
        }



        $('#' + '<%= imbFirst.ClientID %>').mouseover(function () {
            this.src = '../App_Themes/default/images/cr/first_over.gif';
        });

        $('#' + '<%= imbFirst.ClientID %>').mouseout(function () {
            this.src = '../App_Themes/default/images/cr/first.gif';
        });

        $('#' + '<%= imbPrev.ClientID %>').mouseover(function () {
            this.src = '../App_Themes/default/images/cr/prev_over.gif';
        });

        $('#' + '<%= imbPrev.ClientID %>').mouseout(function () {
            this.src = '../App_Themes/default/images/cr/prev.gif';
        });

        $('#' + '<%= imbNext.ClientID %>').mouseover(function () {
            this.src = '../App_Themes/default/images/cr/next_over.gif';
        });

        $('#' + '<%= imbNext.ClientID %>').mouseout(function () {
            this.src = '../App_Themes/default/images/cr/next.gif';
        });

        $('#' + '<%= imbLast.ClientID %>').mouseover(function () {
            this.src = '../App_Themes/default/images/cr/last_over.gif';
        });

        $('#' + '<%= imbLast.ClientID %>').mouseout(function () {
            this.src = '../App_Themes/default/images/cr/last.gif';
        });

        $('#' + '<%= imbGoTo.ClientID %>').mouseover(function () {
            this.src = '../App_Themes/default/images/cr/gotopage_over.gif';
        });

        $('#' + '<%= imbGoTo.ClientID %>').mouseout(function () {
            this.src = '../App_Themes/default/images/cr/gotopage.gif';
        });

        $('#' + '<%= imbRefresh.ClientID %>').mouseover(function () {
            this.src = '../App_Themes/default/images/cr/refresh_over.gif';
        });

        $('#' + '<%= imbRefresh.ClientID %>').mouseout(function () {
            this.src = '../App_Themes/default/images/cr/refresh.gif';
        });

        $('#' + '<%= imbPrint.ClientID %>').mouseover(function () {
            this.src = '../App_Themes/default/images/cr/print_over.gif';
        });

        $('#' + '<%= imbPrint.ClientID %>').mouseout(function () {
            this.src = '../App_Themes/default/images/cr/print.gif';
        });

        $('#' + '<%= imbSearch.ClientID %>').mouseover(function () {
            this.src = '../App_Themes/default/images/cr/search_over.gif';
        });

        $('#' + '<%= imbSearch.ClientID %>').mouseout(function () {
            this.src = '../App_Themes/default/images/cr/search.gif';
        });

        $('#' + '<%= imbClose.ClientID %>').mouseover(function () {
            this.src = '../App_Themes/default/images/cr/close_over.gif';
        });

        $('#' + '<%= imbClose.ClientID %>').mouseout(function () {
            this.src = '../App_Themes/default/images/cr/close.gif';
        });

    });
</script>
<div style="width: 100%; background: #ECE9D8">
    <table>
        <tr>
            <td>
                <asp:ImageButton ID="imbFirst" OnClick="imbFirst_Click" runat="server" ImageUrl="~/App_Themes/default/images/cr/first.gif"
                    AlternateText="First Page" />
            </td>
            <td>
                <asp:ImageButton ID="imbPrev" OnClick="imbPrev_Click" runat="server" ImageUrl="~/App_Themes/default/images/cr/prev.gif"
                    AlternateText="Prev Page" />
            </td>
            <td>
                <asp:ImageButton ID="imbNext" OnClick="imbNext_Click" runat="server" ImageUrl="~/App_Themes/default/images/cr/next.gif"
                    AlternateText="Next Page" />
            </td>
            <td>
                <asp:ImageButton ID="imbLast" OnClick="imbLast_Click" runat="server" ImageUrl="~/App_Themes/default/images/cr/last.gif"
                    AlternateText="Last Page" />
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                <asp:Label ID="lblCurrentPage" Text="1" runat="server"></asp:Label>&nbsp;/&nbsp;
                <asp:Label ID="lblTotalPages" runat="server"></asp:Label>
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                <asp:TextBox ID="txtNewPage" SkinID="TextBox" Width="35" MaxLength="5" runat="server"></asp:TextBox>
            </td>
            <td>
                <asp:ImageButton ID="imbGoTo" runat="server" OnClick="imbGoTo_Click" ImageUrl="~/App_Themes/default/images/cr/gotopage.gif"
                    ToolTip="Go To Page" AlternateText="Go To Page" />
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                <asp:DropDownList ID="ddlPageWidth" runat="server" OnSelectedIndexChanged="ddlPageWidth_SelectedIndexChanged"
                    AutoPostBack="true" SkinID="DropdownList">
                    <asp:ListItem Value="1">Page Width</asp:ListItem>
                    <asp:ListItem Value="2">Whole Page</asp:ListItem>
                    <asp:ListItem Value="500">500%</asp:ListItem>
                    <asp:ListItem Value="200">200%</asp:ListItem>
                    <asp:ListItem Value="150">150%</asp:ListItem>
                    <asp:ListItem Value="100">100%</asp:ListItem>
                    <asp:ListItem Value="75">75%</asp:ListItem>
                    <asp:ListItem Value="50">50%</asp:ListItem>
                    <asp:ListItem Value="25">25%</asp:ListItem>
                    <asp:ListItem Value="10">10%</asp:ListItem>
                </asp:DropDownList>
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                <asp:TextBox ID="txtSearch" SkinID="TextBox" runat="server"></asp:TextBox>
            </td>
            <td>
                <asp:ImageButton ID="imbSearch" runat="server" ImageAlign="Middle" AlternateText="Search"
                    ToolTip="Search data" OnClick="imbSearch_Click" ImageUrl="~/App_Themes/default/images/cr/Search.gif" />
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                <asp:DropDownList ID="ddlExportType" SkinID="DropdownList" runat="server">
                    <asp:ListItem Value="-1">Select a format</asp:ListItem>
                    <asp:ListItem Value="excel">- Excel</asp:ListItem>
                    <asp:ListItem Value="pdf">- Acrobat (PDF) file</asp:ListItem>
                </asp:DropDownList>
                &nbsp;
                <asp:LinkButton ID="btnExport" Text="Export" OnClick="btnExport_Click" runat="server"
                    SkinID="LinkButton" />
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                <asp:ImageButton ID="imbRefresh" runat="server" ImageAlign="Middle" AlternateText="Refresh"
                    ToolTip="Refresh data" OnClick="imbRefresh_Click" ImageUrl="~/App_Themes/default/images/cr/refresh.gif" />
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                <asp:UpdatePanel ID="upPrint" UpdateMode="Conditional" runat="server">
                    <ContentTemplate>
                        <asp:ImageButton ID="imbPrint" runat="server" ImageAlign="Middle" AlternateText="Print"
                            ToolTip="Print data" OnClick="imbPrint_Click" ImageUrl="~/App_Themes/default/images/cr/print.gif" />
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                View&nbsp;:&nbsp;
                <asp:DropDownList ID="ddlView" AutoPostBack="true" SkinID="DropdownList" OnSelectedIndexChanged="ddlView_SelectedIndexChanged"
                    runat="server">
                    <asp:ListItem Value="detail">- Detail</asp:ListItem>
                    <asp:ListItem Value="total">- Total</asp:ListItem>
                </asp:DropDownList>
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                <asp:ImageButton ID="imbClose" runat="server" ImageAlign="Middle" AlternateText="Close"
                    ToolTip="Close window" ImageUrl="~/App_Themes/default/images/cr/close.gif" OnClientClick="javascript:window.close();" />
            </td>
        </tr>
    </table>
</div>
<rsweb:ReportViewer ID="rptViewer" ShowBackButton="false" ShowCredentialPrompts="false" In
    ShowDocumentMapButton="false" ShowExportControls="false" ShowFindControls="false"
    ShowPageNavigationControls="false" ShowParameterPrompts="false" ShowPrintButton="false"
    ShowPromptAreaButton="false" ShowRefreshButton="false" ShowZoomControl="false"
    SizeToReportContent="true" runat="server" Width="100%">
</rsweb:ReportViewer>
<asp:Panel ID="pnlNoDataFound" runat="server">
    <table style="padding-left: 8px">
        <tr>
            <td>
                No Data Found
            </td>
        </tr>
    </table>
</asp:Panel>

   <iframe id="frmPrint" name="IframeName" width="500" 
  height="200" runat="server" style="display: none" ></iframe>